<div class="main-content">
	<header>
		<a href="<?php echo bu('admin/articles/new'); ?>" class="fr button button-gray">Add Article</a>
		<h2>Articles</h2>
	</header>

	<section>
    <?php echo $this->renderPartial('/partials/_notifications'); ?>
		<table class="datatable paginate sortable full">
			<thead>
			<tr>
				<th>Subject</th>
				<th>For</th>
				<th>Created At</th>
				<th>Modified At</th>
				<th style="width:70px"></th>
			</tr>
			</thead>
			<tbody>
			<?php foreach ($articles as $article){ ?>
			<tr>
				<td align="center"><?php echo $article->subject; ?></td>
				<td align="center"><?php if(isset($article->member)){ echo $article->member->name; }else{ echo "Everyone"; } ?></td>
				<td align="center"><?php echo Helpers::customDate($article->created_at); ?></td>
				<td align="center"><?php echo Helpers::customDate($article->modified_at); ?></td>
				<td>
				<ul class="action-buttons">
					<li><a href="<?php echo bu('admin/articles/edit'); ?>?id=<?php echo $article->id; ?>" class="button button-gray no-text"><span class="pencil"></span>Edit</a></li>
					<li><a href="<?php echo bu('admin/articles/delete'); ?>?id=<?php echo $article->id; ?>" method="POST" class="button button-gray no-text"><span class="bin"></span>Delete</a></li>
				</ul>
				</td>
			</tr>
			<?php } ?>
			</tbody>
		</table>
	</section>
</div>